package org.example.entity;


import java.util.Date;
import java.util.List;

/**
 * 数据库表实体
 *
 */
public class TableEntity {
    /**
     * 表的名称
     */
    private String tableName;

    /**
     * 数据库引擎
     */
    private String engine;

    /**
     * 表的备注
     */
    private String comments;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 表的主键
     */
    private ColumnEntity pk;

    /**
     * 表的列名
     */
    private List<ColumnEntity> columns;


    /**
     * 设置表名
     *
     * @param tableName
     */
    public void setTableName(String tableName) {
        //将表名转换成小写
        this.tableName = tableName.toLowerCase();
    }

    public String getTableName() {
        return tableName;
    }

    public String getEngine() {
        return engine;
    }

    public void setEngine(String engine) {
        this.engine = engine;
    }

    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public ColumnEntity getPk() {
        return pk;
    }

    public void setPk(ColumnEntity pk) {
        this.pk = pk;
    }

    public List<ColumnEntity> getColumns() {
        return columns;
    }

    public void setColumns(List<ColumnEntity> columns) {
        this.columns = columns;
    }

    @Override
    public String toString() {
        return "TableEntity{" +
                "tableName='" + tableName + '\'' +
                ", engine='" + engine + '\'' +
                ", comments='" + comments + '\'' +
                ", createTime=" + createTime +
                ", pk=" + pk +
                ", columns=" + columns +
                '}';
    }
}
